package com.audaque.springboot.foshanupload.web.esdatademo.model.pojo;

import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

import java.io.Serializable;

/**
 * @author zhongguobin
 * @date 2024-03-24 15:15
 * @description TODO
 */

@Data
@Getter
@Setter
@Accessors(chain = true)
@Document(indexName = "utour_countries", shards = 1, replicas = 1)
@Schema(name = "Country", description = "国家")
public class Country implements Serializable {
    private static final long serialVersionUID = 1L;


    //使用 @Id 注解的字段作为文档的 _id 值
    @Id
    @JsonProperty("_id")
    @Schema(description = "_id")
    @Field(value = "_id")
    //与实际对应
    private String _id;//主键

    @Schema(description = "id")
    @Field(value = "id", type = FieldType.Long)
    private Long id;

    @Schema(description = "名称")
    @Field(type = FieldType.Text, analyzer = "ik_max_word")
    private String name;

    @Schema(description = "编号")
    @Field(type = FieldType.Text, analyzer = "ik_max_word")
    private String code;

    @Schema(description = "简体中文")
    @Field(type = FieldType.Text, analyzer = "ik_max_word")
    private String cn;

    @Schema(description = "全拼")
    @Field(type = FieldType.Text, analyzer = "ik_max_word")
    private String py;

    @Schema(description = "首拼")
    @Field(type = FieldType.Text, analyzer = "ik_max_word")
    private String py1;

    @Schema(description = "繁体中文")
    @Field(value = "zh-hant", type = FieldType.Text, analyzer = "ik_max_word")
    private String zhHant;


}
